<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Class</title>
</head>

<body>
    <script>
        class Range {
            constructor(start, end) {
                this.start = start;
                this.end = end;
            }
            [Symbol.iterator]() {
                return this;
            }
            next() {
                let start = this.start;
                if( start < this.end ) {
                    this.start ++;
                    return {value: start}
                }
                return {done: true}
            }
        }

        let range = new Range(1, 3);
        for (let x of range) {
            console.log(x);
        }
    </script>
</body>

</html>